package com.lee.config;

import org.apache.ibatis.logging.slf4j.Slf4jImpl;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.ExecutorType;
import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.annotation.Bean;

/**
 * @Description: (Mybatis配置类)
 * @Auther: LiPengFei
 * @Date: 2018/10/1 00:08
 */
@org.springframework.context.annotation.Configuration
public class MybatisConfig {
    @Bean
    public ConfigurationCustomizer configurationCustomizer() {
        return new ConfigurationCustomizer() {
            @Override
            public void customize(Configuration configuration) {
                configuration.setMapUnderscoreToCamelCase(true);
                configuration.setCacheEnabled(true);
                configuration.setUseGeneratedKeys(true);
                configuration.setDefaultExecutorType(ExecutorType.REUSE);
                configuration.setLogImpl(Slf4jImpl.class);
            }
        };
    }
}
